To: OpenDoc Development Framework Discussion List, ODF-Interest@CILabs.
For anyone that is interested, I have worked out a possible solution to the refCounting problems you encounter if you call SetPropagateEvents(true) on one of your embedded frames. The problem is that if you set an embedded frame to propagate events, the containing Frame's refCount will be decrement every time an event associated with a facet (like a mouse event) is propagated, which eventually leads to a crash. Until a fix is available in OpenDoc, you can put the following logic inside your part's HandleEvent method:
Note that when the problem is fixed in OpenDoc, this fix will cause your frame to have too many refs, so it will not get flushed from memory. However, if you need propagated events, too many refs are better than too few.
If you are using ODF it is a little more complicated. You need to create your own subclass of FW_CEventDispatcher, put the above code in an override of the Dispatch method (as well as a call to the parent's Dispatch), and then override PrivNewEventDispatcher in your FW_CPart subclass to install your dispatcher.
I have been testing this for a while and it looks good, but I suggest doing your own tests too. Let me know if anyone finds any problems with this.
Thanks again to Christopher Linn for helping us work this out.